package com.atguigu.yygh.hosp.controller.user;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.model.acl.User;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @Author luoyin
 * @Date 10:30 2022/9/22
 **/
@RestController
@RequestMapping("/admin/user")
@Slf4j
@Api(description = "用户管理")
public class UserController {

    @PostMapping("/login")
    public R login(@RequestBody User user){
        log.debug(user.getUsername());
        log.debug(user.getPassword());
        return R.ok().data("token","admin-token");
    }

    //"data":{"roles":["admin"],"introduction":"I am a super administrator","avatar":"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif","name":"Super Admin"}
    @GetMapping("/info")
    public R info(String token){
        return R.ok().data("roles","[admin]")
                .data("introduction","I am a super administrator")
                .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif")
                .data("name","大黄蜂");
    }

    @PostMapping("/logout")
    public R logout(){
        return R.ok();
    }
}
